package com.reservationserver.controller.user;

import com.reservationpojo.domin.vo.Usercommentvo;
import com.reservationpojo.entity.Comment;
import com.reservationpojo.utils.Result;
import com.reservationserver.service.admin.Commentservice;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RequestMapping("/usercomments")
@RestController
@RequiredArgsConstructor
public class UsercommentsController {
    private final Commentservice commentservice;


    @GetMapping("/getcomments")
public Result getusercomments(String userId){
        log.info("{}",userId);
        List<Comment> comments=commentservice.getUserComment(userId);
    return Result.success(comments);
}

@PostMapping("/addcomment")
    public Result addusercomments(@RequestBody Usercommentvo usercommentvo){

        commentservice.insretcomment(usercommentvo);
        return Result.success();
}

    @PostMapping("/deletecomment")
    public Result deleteusercomments(String commentId){
        commentservice.deletecomment(commentId);

        return Result.success();
    }
}
